Skip to content

Local QueryPlan generation and emulator execution#4312

Open
FabianMeiswinkel wants to merge 59 commits intoAzure:release/azure_data_cosmos-previewsfrom
FabianMeiswinkel:users/fabianm/LocalQueryPlanPOC
Open

Local QueryPlan generation and emulator execution#4312
FabianMeiswinkel wants to merge 59 commits intoAzure:release/azure_data_cosmos-previewsfrom
FabianMeiswinkel:users/fabianm/LocalQueryPlanPOC

Conversation

@FabianMeiswinkel
Copy link
Copy Markdown
Member

@FabianMeiswinkel FabianMeiswinkel commented Apr 29, 2026

This PR adds an option to generate query plans locally insteadof relying on Gateway I/O calls to get them.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new Cosmos SQL query crate and wires it into azure_data_cosmos to enable local query-plan generation (partition targeting + structural query info) and an in-memory evaluator intended for emulator/test scenarios.

Changes:

  • Add new crate azure_data_cosmos_query implementing a lexer, recursive-descent parser, query-plan analysis (PK extraction + structural info), and in-memory evaluation.
  • Add azure_data_cosmos client-side query-plan generation module plus extensive plan comparison tests.
  • Update workspace/crate dependency wiring (including workspace membership changes and lockfile refresh).

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
sdk/cosmos/query-engine-porting-plan.md New design/porting plan for a Rust query engine subset and test strategy.
sdk/cosmos/azure_data_cosmos_query/src/ast/mod.rs Defines Cosmos SQL AST types used by parser/plan/eval.
sdk/cosmos/azure_data_cosmos_query/src/lexer/mod.rs SQL lexer producing tokens with spans, keywords, operators, comments handling.
sdk/cosmos/azure_data_cosmos_query/src/parser/mod.rs Recursive descent + precedence parsing for Cosmos SQL into AST.
sdk/cosmos/azure_data_cosmos_query/src/plan/mod.rs Query plan generation (PK filter extraction + structural QueryInfo).
sdk/cosmos/azure_data_cosmos_query/src/eval/mod.rs In-memory WHERE matching + SELECT projection + simple TOP/OFFSET/LIMIT.
sdk/cosmos/azure_data_cosmos_query/src/value.rs CosmosValue comparison semantics + JSON conversions + unit tests.
sdk/cosmos/azure_data_cosmos_query/src/lib.rs Crate public surface (modules + parse + CosmosValue).
sdk/cosmos/azure_data_cosmos_query/Cargo.toml New crate manifest added to workspace deps.
sdk/cosmos/azure_data_cosmos_driver/Cargo.toml Switch azure_core dependency to workspace-sourced.
sdk/cosmos/azure_data_cosmos/tests/query_plan_comparison.rs Adds exhaustive tests asserting full query plan equivalence (structural + PK).
sdk/cosmos/azure_data_cosmos/src/query/plan.rs Adds client-side query plan generation + partition targeting resolution.
sdk/cosmos/azure_data_cosmos/src/query/mod.rs Exposes new query::plan module.
sdk/cosmos/azure_data_cosmos/Cargo.toml Adds dependency on query crate; changes feature wiring and versions.
Cargo.toml Adds new workspace member; removes other Cosmos workspace members; adds workspace deps entry.
Cargo.lock Lockfile regenerated to reflect new workspace graph.

Comment thread Cargo.toml
Comment thread sdk/cosmos/azure_data_cosmos/Cargo.toml Outdated
Comment thread sdk/cosmos/azure_data_cosmos/Cargo.toml Outdated
Comment thread sdk/cosmos/azure_data_cosmos_query/src/parser/mod.rs Outdated
Comment thread sdk/cosmos/azure_data_cosmos_query/src/eval/mod.rs Outdated
Comment thread sdk/cosmos/azure_data_cosmos_query/Cargo.toml Outdated
Comment thread sdk/cosmos/query-engine-porting-plan.md Outdated
Comment thread sdk/cosmos/azure_data_cosmos_query/src/plan/mod.rs Outdated
Comment thread sdk/cosmos/azure_data_cosmos_query/src/eval/mod.rs Outdated
Comment thread sdk/cosmos/azure_data_cosmos/src/query/plan.rs Outdated
FabianMeiswinkel and others added 3 commits April 29, 2026 23:26
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread Cargo.toml Outdated
@FabianMeiswinkel FabianMeiswinkel marked this pull request as draft April 30, 2026 00:16
@FabianMeiswinkel
Copy link
Copy Markdown
Member Author

/azp run rust - cosmos - weekly

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@FabianMeiswinkel
Copy link
Copy Markdown
Member Author

/azp run rust - cosmos - weekly

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@FabianMeiswinkel
Copy link
Copy Markdown
Member Author

/azp run rust - cosmos - weekly

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@FabianMeiswinkel
Copy link
Copy Markdown
Member Author

/azp run rust - cosmos - weekly

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@FabianMeiswinkel
Copy link
Copy Markdown
Member Author

/azp run rust - cosmos - weekly

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@FabianMeiswinkel
Copy link
Copy Markdown
Member Author

/azp run rust - cosmos - weekly

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cosmos The azure_cosmos crate

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants